package com.xxkk.spring_boot_web.controller;


import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.Map;
import java.util.UUID;

/**
 * Applicationx
 *
 * @author peiyu
 * @date 2023/10/24
 */
@Controller
public class TestControl {
    @CrossOrigin
    @RequestMapping("/test")
    @ResponseBody
    public String test(HttpServletRequest re, HttpServletResponse response) {
        try {
            Map map = re.getParameterMap();
            JSONObject jobj = new JSONObject(map);
            String str = jobj.toString();
            System.out.println(str);
            return str;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "{'exception':'fail'}";
    }
}
